package com.itheima;

import com.itheima.autoconfig.HuanXin.HuanXinProperties;
import com.itheima.autoconfig.HuanXin.HuanXinTemplate;
import com.itheima.autoconfig.face.AipFaceProperties;
import com.itheima.autoconfig.face.AipFaceTemplate;
import com.itheima.autoconfig.oss.OssProperties;
import com.itheima.autoconfig.oss.OssTemplate;
import com.itheima.autoconfig.sms.SmsProperties;
import com.itheima.autoconfig.sms.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//用于将SmsTemplate放入容器
@Configuration
@EnableConfigurationProperties({
        SmsProperties.class,  //加载短信配置
        OssProperties.class,  //加载阿里云图片上传配置
        AipFaceProperties.class, //加载百度人脸识别功能
        HuanXinProperties.class//加载环信配置
})
public class TanhuaAutoConfiguration {

    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties){
        return new SmsTemplate(smsProperties);
    }
    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return  new OssTemplate(ossProperties);
    }
    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties){
        return new AipFaceTemplate(aipFaceProperties);
    }
    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties) {
        return new HuanXinTemplate(huanXinProperties);
    }
}
